<div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">新增客户</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Basic Form Elements
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-8">
                                    <form role="form" id="login_form" method="post" action="<?=site_url('customer/c_create') ?>">
                                        <div class="form-group">
                                            <label>真实姓名：</label>
                                            <input class="form-control" name="cname">
                                            <p class="help-block">请准确填写用户信息</p>
                                        </div>
                                        <div class="form-group">
                                            <label>联系电话：</label>
                                            <input class="form-control" name="phone">
                                        </div>
                                        <div class="form-group">
                                            <label>使用邮箱：</label>
                                            <input class="form-control" name="email">
                                            <p class="help-block">非必填项，没有可不填</p>
                                        </div>

                                        <div class="form-group">
                                            <label>地区：</label>
                                            <input class="form-control" name="address">
                                            <p class="help-block">请标示用户所在大概地区</p>
                                        </div>

                                        <div class="form-group">
                                            <label>客户类型：</label>
                                            <select class="form-control" name="ctype">
                                                <option value="1">初步接触</option>
                                                <option value="2">有意向</option>
                                                <option value="3">待开发</option>
                                                <option value="4">开发中</option>
                                                <option value="5">已合作</option>
                                            </select>
                                        </div>

                                        <div class="form-group">
                                            <label>客户来源：<a href="javascript:;" onclick="add_source()" class="btn btn-primary">新增</a></label>
                                            <select class="form-control form-group" name="source_id" id="source">
                                                <?php foreach($sou_list as $k => $v):?>
                                                <option value="<?=$v['id']?>" id="v_<?=$v['id']?>"><?=$v['title']?></option>
                                                <?php endforeach;?>
                                            </select>
                                        </div>

                                        <div class="form-group" >
                                            <label>客户级别：</label>
                                            <select class="form-control form-group" name="crank">
                                                <option value="1">普通客户</option>
                                                <option value="2">劣质客户</option>
                                                <option value="3">优质客户</option>
                                                <option value="4">重点客户</option>
                                                <option value="5">潜在客户</option>
                                                <option value="6">钻石客户</option>
                                                <option value="7">VIP客户</option>
                                            </select>
                                        </div>

                                        <div class="form-group">
                                            <label>备注：</label>
                                            <input class="form-control" name="beizhu">
                                        </div>


                                        <button type="submit" class="btn btn-primary">新增客户</button>
                                        <button type="reset" class="btn btn-default">重置</button>
                                    </form>
                                </div>
                                <!-- /.col-lg-6 (nested) -->
                            </div>
                            <!-- /.row (nested) -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
        </div>
<script type="text/javascript">
    layer.config({
        extend: 'extend/layer.ext.js'
    });
    $('#login_form').submit(function() {
        var index = layer.load(2);
        $(this).ajaxSubmit(function(data){
            layer.close(index);
            get_res(data,'<?=site_url("customer/index")?>');
        })
        return false;
    })

    function add_source(){
        layer.prompt({
            title: '请输入新的来源',
            formType: 2
        }, function(val){
            $.post("<?=site_url('source/s_create')?>",{title:val},function(data){
            if(data > 0){
                l = '<option value="'+data+'" selected>'+val+'</option>';
                $("#v_"+data).remove();
                $("#source").append(l);
                layer.closeAll();
            }else{
                layer.alert(data,{
                    icon:2,
                });
            }
            })
        });
    }
</script>